package me.jessyan.armscomponent.app.mvp.ui.activity.mine;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.jess.arms.base.BaseActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;

import butterknife.OnClick;
import me.jessyan.armscomponent.commonsdk.core.RouterHub;
import me.jessyan.armscomponent.commonsdk.utils.Utils;
import me.jessyan.armscomponent.app.R;
import me.jessyan.armscomponent.app.di.component.DaggerMineMsgCenterComponent;
import me.jessyan.armscomponent.app.mvp.contract.mine.MineMsgCenterContract;
import me.jessyan.armscomponent.app.mvp.presenter.mine.MineMsgCenterPresenter;

import static com.jess.arms.utils.Preconditions.checkNotNull;


/**
 * <p>
 * Author: Taozebi
 * Date: 09/08/2021 20:43
 * Description: 个人中心-消息
 */
@Route(path = RouterHub.MINE_MSGCENTERACTIVITY)
public class MineMsgCenterActivity extends BaseActivity<MineMsgCenterPresenter> implements MineMsgCenterContract.View {

    @Override
    public void setupActivityComponent(@NonNull AppComponent appComponent) {
        DaggerMineMsgCenterComponent //如找不到该类,请编译一下项目
                .builder()
                .appComponent(appComponent)
                .view(this)
                .build()
                .inject(this);
    }

    @Override
    public int initView(@Nullable Bundle savedInstanceState) {
        return R.layout.mine_activity_msg_center; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
    }


    @Override
    public void initData(@Nullable Bundle savedInstanceState) {
        loadTitle();
    }


    private void loadTitle() {
        setTitle("我的消息");
    }

    @Override
    public void showLoading() {

    }

    @Override
    public void hideLoading() {

    }

    @OnClick({R.id.mine_msg_center_tv_01,R.id.mine_msg_center_tv_02, R.id.mine_msg_center_tv_03})
    public void onClicked(View view) {
        int id = view.getId();
        if (id == R.id.mine_msg_center_tv_01) {
            if (Utils.isFastClick()) {
                ARouter.getInstance().build(RouterHub.MINE_MSGACTIVITY).navigation();
            }
        } else if (id == R.id.mine_msg_center_tv_02) {
            if (Utils.isFastClick()) {
                ARouter.getInstance().build(RouterHub.MINE_MSGACTIVITY).navigation();
            }
        } else if (id == R.id.mine_msg_center_tv_03) {
            if (Utils.isFastClick()) {
                ARouter.getInstance().build(RouterHub.MINE_MSGACTIVITY).navigation();
            }
        }
    }

    @Override
    public void showMessage(@NonNull String message) {
        checkNotNull(message);
        ArmsUtils.snackbarText(message);
    }

    @Override
    public void launchActivity(@NonNull Intent intent) {
        checkNotNull(intent);
        ArmsUtils.startActivity(intent);
    }

    @Override
    public void killMyself() {
        finish();
    }
}
